#pragma once

#include "InformationItem.h"

#include "Classifier.h"

namespace uml {

InformationItem::InformationItem(const QString& umlType)
    : Classifier(umlType) {}

void InformationItem::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (json.isEmpty()) {
        return;
    }

    Classifier::fromJson(json, errorList);
    JsonSerializable::fromJsonArray(representeds_, "representeds", json, errorList);
}

void InformationItem::toJson(QJsonObject& json) {
    Classifier::toJson(json);
    JsonSerializable::toJsonArray(representeds_, "representeds", json);
}

/// <summary>
/// representeds getter
/// Determines the classifiers that will specify the structure and nature of the
/// information. An information item represents all its represented classifiers.
/// </summary>
vector<shared_ptr<Classifier>>& InformationItem::representeds() {
    return representeds_;
}

} // namespace uml
